package org.hank.demoproject

import com.google.gson.Gson
import org.hank.demoproject.bills.*
import org.hank.demoproject.bills.BillsUtils.getBillsFromStr
import org.hank.demoproject.bills.BillsUtils.getCurrentTime
import org.hank.demoproject.bills.BillsUtils.getFlowFromStr
import org.hank.demoproject.bills.BillsUtils.handleFlow
import org.junit.Test
import java.util.*

//  ┏┓　　　┏┓
//┏┛┻━━━┛┻┓
//┃　　　　　　　┃
//┃　　　━　　　┃
//┃　┳┛　┗┳　┃
//┃　　　　　　　┃
//┃　　　┻　　　┃
//┃　　　　　　　┃
//┗━┓　　　┏━┛
//    ┃　　　┃                  神兽保佑
//    ┃　　　┃                  永无BUG！
//    ┃　　　┗━━━┓
//    ┃　　　　　　　┣┓
//    ┃　　　　　　　┏┛
//    ┗┓┓┏━┳┓┏┛
//      ┃┫┫　┃┫┫
//      ┗┻┛　┗┻┛
/**
 *@auth: Hank
 *邮箱: cs16xiaoc1@163.com
 *创建时间: 2022/1/21 14:31
 *描述:
 */
class UPSTest {

    @Test
    fun strTest() {
        var strTest = "vendorid - 816"
        System.out.println(strTest.split("###"))
    }

    @Test
    fun main() {
        var data =
            "{'billsmenuname':'PAYARENA','billers':'billername - EKEDC POSTPAID###printall - true###vendorid - 816###istoken - true###conveniencefee - ###printvalidation - true###labels - labelname - METERNO###value - ###inputtype - numeric###lengthrule - ###revalidate - false###capturetoken - true###printvalue - true,labelname - PHONENO###value - ###inputtype - numeric###lengthrule - ###revalidate - false###capturetoken - true###printvalue - true###products - ,billername - IBEDC POSTPAID###printall - true###vendorid - 200018###istoken - true###conveniencefee - 107.50###printvalidation - true###labels - labelname - METERNUMBER###value - ###inputtype - numeric###lengthrule - ###revalidate - false###capturetoken - true###printvalue - true,labelname - PHONENUMBER###value - ###inputtype - numeric###lengthrule - ###revalidate - false###capturetoken - true###printvalue - true###products - ,billername - DSTV###printall - true###vendorid - 756###istoken - true###conveniencefee - 107.50###printvalidation - false###labels - labelname - SMARTCARD NUMBER###value - ###inputtype - numeric###lengthrule - ###revalidate - false###capturetoken - true###printvalue - true,labelname - PHONE NUMBER###value - ###inputtype - numeric###lengthrule - ###revalidate - false###capturetoken - true###printvalue - true###products - ,billername - EKEDC PREPAID###printall - true###vendorid - 817###istoken - true###conveniencefee - ###printvalidation - true###labels - labelname - METERNO###value - ###inputtype - numeric###lengthrule - ###revalidate - false###capturetoken - true###printvalue - true,labelname - PHONENO###value - ###inputtype - numeric###lengthrule - ###revalidate - false###capturetoken - true###printvalue - true###products - ,billername - STS PREPAID###printall - true###vendorid - 200154###istoken - true###conveniencefee - ###printvalidation - true###labels - labelname - METER NUMBER###value - ###inputtype - numeric###lengthrule - <20###revalidate - false###capturetoken - true###printvalue - true,labelname - PHONE NUMBER###value - ###inputtype - numeric###lengthrule - =11###revalidate - false###capturetoken - true###printvalue - true###products - ,billername - MTN###printall - false###vendorid - 2347037819054###istoken - true###conveniencefee - ###printvalidation - false###labels - labelname - PHONE NUMBER###value - ###inputtype - numeric###lengthrule - ###revalidate - false###capturetoken - true###printvalue - true###products - productname - MTN 100###value - 100.00,productname - MTN 200###value - 200.00,productname - MTN 400###value - 400.00,productname - MTN 500###value - 500.00,productname - OTHERS###value - ,billername - GOTV###printall - true###vendorid - 858###istoken - true###conveniencefee - 107.5###printvalidation - false###labels - labelname - SMART CARD NO###value - ###inputtype - numeric###lengthrule - ###revalidate - true###capturetoken - true###printvalue - true,labelname - PHONE NO###value - ###inputtype - numeric###lengthrule - ###revalidate - false###capturetoken - true###printvalue - true###products - ,billername - SWIFT TOPUP###printall - true###vendorid - 760###istoken - true###conveniencefee - 107.50###printvalidation - false###labels - labelname - CUSTOMER ID###value - ###inputtype - numeric###lengthrule - ###revalidate - false###capturetoken - true###printvalue - true,labelname - PHONE NO###value - ###inputtype - numeric###lengthrule - ###revalidate - false###capturetoken - true###printvalue - true###products - ,billername - SWIFT ACCESSORIES###printall - true###vendorid - 759###istoken - true###conveniencefee - 100###printvalidation - true###labels - labelname - CUSTOMER ID###value - ###inputtype - numeric###lengthrule - ###revalidate - false###capturetoken - true###printvalue - true,labelname - PHONE NUMBER###value - ###inputtype - numeric###lengthrule - ###revalidate - false###capturetoken - true###printvalue - true###products - ,billername - SWIFT SUBSCRIPTION###printall - true###vendorid - 761###istoken - true###conveniencefee - 107.50###printvalidation - true###labels - labelname - CUSTOMER ID###value - ###inputtype - numeric###lengthrule - ###revalidate - false###capturetoken - true###printvalue - true,labelname - PHONE NO###value - ###inputtype - numeric###lengthrule - ###revalidate - false###capturetoken - true###printvalue - true###products - ,billername - SMILE TOPUP###printall - true###vendorid - 5153###istoken - true###conveniencefee - 107.50###printvalidation - false###labels - labelname - CUSTOMERID###value - ###inputtype - numeric###lengthrule - ###revalidate - false###capturetoken - true###printvalue - true,labelname - PHONENO###value - ###inputtype - numeric###lengthrule - ###revalidate - false###capturetoken - true###printvalue - true###products - ,billername - STARTIME###printall - true###vendorid - 5247###istoken - true###conveniencefee - 107.5###printvalidation - false###labels - labelname - ENTER SMART CARD NO###value - ###inputtype - numeric###lengthrule - ###revalidate - false###capturetoken - true###printvalue - true,labelname - ENTER PHONE NO###value - ###inputtype - numeric###lengthrule - ###revalidate - false###capturetoken - true###printvalue - true###products - ,billername - POSTPAID###printall - true###vendorid - 200153###istoken - true###conveniencefee - 100###printvalidation - false###labels - labelname - METER NUMBER###value - ###inputtype - numeric###lengthrule - ###revalidate - false###capturetoken - true###printvalue - true,labelname - PHONE NUMBER###value - ###inputtype - numeric###lengthrule - ###revalidate - false###capturetoken - true###printvalue - true###products - ,billername - SMILE DATA BUNDLE###printall - true###vendorid - 5154..###istoken - true###conveniencefee - 100###printvalidation - false###labels - ###products - ,billername - IKEJA PREPAID###printall - true###vendorid - 200032###istoken - true###conveniencefee - ###printvalidation - false###labels - labelname - METER NUMBER###value - ###inputtype - numeric###lengthrule - ###revalidate - false###capturetoken - true###printvalue - true,labelname - PHONE NUMBER###value - ###inputtype - numeric###lengthrule - ###revalidate - true###capturetoken - true###printvalue - true###products - ,billername - LCC ###printall - true###vendorid - 5107###istoken - true###conveniencefee - ###printvalidation - false###labels - labelname - ENTER TAG NO###value - ###inputtype - alphanumericspecial###lengthrule - ###revalidate - false###capturetoken - true###printvalue - true,labelname - PHONE NUMBER###value - ###inputtype - numeric###lengthrule - ###revalidate - false###capturetoken - true###printvalue - true###products - ,billername - IBEDC PREPAID###printall - true###vendorid - 200017###istoken - true###conveniencefee - 107.50###printvalidation - true###labels - labelname - MeterNumber###value - ###inputtype - numeric###lengthrule - ###revalidate - false###capturetoken - true###printvalue - true,labelname - PhoneNumber###value - ###inputtype - numeric###lengthrule - ###revalidate - false###capturetoken - true###printvalue - true###products - ,billername - SMARTMETER PREPAID###printall - true###vendorid - 200152###istoken - true###conveniencefee - 107.5###printvalidation - true###labels - labelname - METER NUMBER###value - ###inputtype - numeric###lengthrule - ###revalidate - false###capturetoken - true###printvalue - true,labelname - PHONE NUMBER###value - ###inputtype - numeric###lengthrule - ###revalidate - false###capturetoken - true###printvalue - true###products - ,billername - GLO###printall - false###vendorid - 2348152747611###istoken - true###conveniencefee - ###printvalidation - false###labels - labelname - PHONE NUMBER###value - ###inputtype - numeric###lengthrule - ###revalidate - false###capturetoken - true###printvalue - true###products - productname - GLO 100###value - 100.00,productname - GLO 200###value - 200.00,productname - GLO 400###value - 400.00,productname - GLO 500###value - 500.00,productname - OTHERS###value - ,billername - 9MOBILE###printall - false###vendorid - 2348094190022###istoken - false###conveniencefee - ###printvalidation - false###labels - labelname - PHONE NO###value - ###inputtype - numeric###lengthrule - ###revalidate - false###capturetoken - true###printvalue - true###products - productname - 9MOBILE 100###value - 100.00,productname - 9MOBILE 200###value - 200.00,productname - 9MOBILE 400###value - 400.00,productname - 9MOBILE 500###value - 500.00,productname - OTHERS###value - ,billername - AIRTEL###printall - false###vendorid - 2347087214896###istoken - true###conveniencefee - ###printvalidation - false###labels - labelname - PHONE NUMBER###value - ###inputtype - numeric###lengthrule - ###revalidate - false###capturetoken - true###printvalue - true###products - productname - AIRTEL 100###value - 100.00,productname - AIRTEL 200###value - 200.00,productname - AIRTEL 400###value - 400.00,productname - AIRTEL 500###value - 500.00,productname - OTHERS###value - ,billername - IKEJA POSTPAID###printall - true###vendorid - 200031###istoken - true###conveniencefee - ###printvalidation - false###labels - labelname - METER NUMBER###value - ###inputtype - numeric###lengthrule - ###revalidate - false###capturetoken - true###printvalue - true,labelname - PHONE NUMBER###value - ###inputtype - numeric###lengthrule - ###revalidate - false###capturetoken - true###printvalue - true###products - ,billername - WITHOUT INVOICE NO###printall - false###vendorid - 200227###istoken - true###conveniencefee - ###printvalidation - false###labels - labelname - PHONE NUMBER###value - ###inputtype - numeric###lengthrule - ###revalidate - false###capturetoken - true###printvalue - true,labelname - MERCHANT CODE###value - ###inputtype - alphanumericspecial###lengthrule - ###revalidate - false###capturetoken - true###printvalue - true###products - ,billername - WITH INVOICE NO###printall - true###vendorid - AMT200228###istoken - true###conveniencefee - ###printvalidation - true###labels - labelname - INVOICE NUMBER###value - ###inputtype - alphanumericspecial###lengthrule - ###revalidate - false###capturetoken - true###printvalue - true###products - ','flow':'step - 0###id - j1_1###text - BILLSMENU###type - default###backid - null###backname - undefined###,step - 1###id - j1_2###text - AIRTIME###type - category###backid - j1_1###backname - BILLSMENU###,step - 2###id - j1_3###text - MTN###type - biller###backid - j1_2###backname - AIRTIME###,step - 3###id - j1_4###text - GLO###type - biller###backid - j1_2###backname - AIRTIME###,step - 4###id - j1_5###text - AIRTEL###type - biller###backid - j1_2###backname - AIRTIME###,step - 5###id - j1_6###text - 9MOBILE###type - biller###backid - j1_2###backname - AIRTIME###,step - 6###id - j1_7###text - BILLS PAYMENT###type - category###backid - j1_1###backname - BILLSMENU###,step - 7###id - j1_8###text - ELECTRICITY###type - category###backid - j1_7###backname - BILLS PAYMENT###,step - 8###id - j1_9###text - EKEDC###type - category###backid - j1_8###backname - ELECTRICITY###,step - 9###id - j1_10###text - EKEDC PREPAID###type - biller###backid - j1_9###backname - EKEDC###,step - 10###id - j1_11###text - EKEDC POSTPAID###type - biller###backid - j1_9###backname - EKEDC###,step - 11###id - j1_12###text - IBEDC###type - category###backid - j1_8###backname - ELECTRICITY###,step - 12###id - j1_13###text - IBEDC PREPAID###type - biller###backid - j1_12###backname - IBEDC###,step - 13###id - j1_14###text - IBEDC POSTPAID###type - biller###backid - j1_12###backname - IBEDC###,step - 14###id - j1_15###text - IKEJA ELECTRIC###type - category###backid - j1_8###backname - ELECTRICITY###,step - 15###id - j1_16###text - IKEJA PREPAID###type - biller###backid - j1_15###backname - IKEJA ELECTRIC###,step - 16###id - j1_17###text - IKEJA POSTPAID###type - biller###backid - j1_15###backname - IKEJA ELECTRIC###,step - 17###id - j1_18###text - ABDC###type - category###backid - j1_8###backname - ELECTRICITY###,step - 18###id - j1_27###text - STS PREPAID###type - biller###backid - j1_18###backname - ABDC###,step - 19###id - j1_37###text - POSTPAID###type - biller###backid - j1_18###backname - ABDC###,step - 20###id - j1_38###text - SMARTMETER PREPAID###type - biller###backid - j1_18###backname - ABDC###,step - 21###id - j1_20###text - LCC###type - category###backid - j1_7###backname - BILLS PAYMENT###,step - 22###id - j1_44###text - LCC ###type - biller###backid - j1_20###backname - LCC###,step - 23###id - j1_40###text - PAY GATE###type - category###backid - j1_7###backname - BILLS PAYMENT###,step - 24###id - j1_41###text - WITH INVOICE NO###type - biller###backid - j1_40###backname - PAY GATE###,step - 25###id - j1_42###text - WITHOUT INVOICE NO###type - biller###backid - j1_40###backname - PAY GATE###,step - 26###id - j1_23###text - CABLE TV###type - category###backid - j1_1###backname - BILLSMENU###,step - 27###id - j1_24###text - GOTV###type - biller###backid - j1_23###backname - CABLE TV###,step - 28###id - j1_25###text - DSTV###type - biller###backid - j1_23###backname - CABLE TV###,step - 29###id - j1_26###text - STARTIME###type - biller###backid - j1_23###backname - CABLE TV###,step - 30###id - j1_30###text - DATA###type - category###backid - j1_1###backname - BILLSMENU###,step - 31###id - j1_31###text - SWIFT NETWORK###type - category###backid - j1_30###backname - DATA###,step - 32###id - j1_32###text - SWIFT TOPUP###type - biller###backid - j1_31###backname - SWIFT NETWORK###,step - 33###id - j1_33###text - SWIFT SUBSCRIPTION###type - biller###backid - j1_31###backname - SWIFT NETWORK###,step - 34###id - j1_34###text - SWIFT ACCESSORIES###type - biller###backid - j1_31###backname - SWIFT NETWORK###,step - 35###id - j1_35###text - SMILE NETWORK###type - category###backid - j1_30###backname - DATA###,step - 36###id - j1_36###text - SMILE DATA BUNDLE###type - biller###backid - j1_35###backname - SMILE NETWORK###,step - 37###id - j1_39###text - SMILE TOPUP###type - biller###backid - j1_35###backname - SMILE NETWORK###','steps':38,'status':200,'message':'Success.'}"
        var menuBean = Gson().fromJson(data, menuBean::class.java)
        System.out.println(menuBean.status)
        var billList = getBillsFromStr(menuBean.billers)
        System.out.println(billList.size)
        var flowList = getFlowFromStr(menuBean.flow)
        System.out.println(flowList?.size)
        System.out.println("before flowhandle" +getCurrentTime())
        var flow = handleFlow(flowList)
        System.out.println(flow?.flows?.size)
        System.out.println("after flowhandle" +getCurrentTime())
    }
}
